<template>
  <el-card class="app-container">
    <c-u-r-d-table :option="option" />
  </el-card>
</template>

<script>

import ColumnType from '@/framework/constant/ColumnType'
import OnlineStatusEnum from '@/framework/constant/OnlineStatusEnum'
import {serviceApi} from '@/feature/service/infra/api/serviceApi'
import CURDTable from '@/framework/components/table/CURDTable'
import {serviceTypeApi} from "@/feature/service/infra/api/serviceTypeApi";

export default {
  components: {CURDTable},
  data() {
    return {
      option: {
        requestApi: serviceApi,
        showSelection: true,
        columns: [
          {
            label: '服务名称',
            prop: 'serviceName',
            searchable: true,
            required: true
          },
          {
            label: '服务类型',
            prop: 'serviceTypeId',
            required: true,
            searchable: true,
            type: ColumnType.SELECT,
            options: serviceTypeApi.listAll()
          },
          {
            label: '服务logo',
            prop: 'serviceLogo',
            type: ColumnType.IMAGE
          },
          {
            label: '服务描述',
            span: 24,
            width: 'auto',
            prop: 'serviceDesc',
            type: ColumnType.TEXTAREA
          },
          {
            label: '状态',
            searchable: true,
            type: ColumnType.RADIO,
            width: 80,
            hiddenInForm: true,
            options: OnlineStatusEnum,
            prop: 'status'
          },
          {
            label: '链接',
            prop: 'link',
            type: ColumnType.TEXTAREA,
            span: 24,
            placeholder: '支持跳转H5、本小程序页面，第三方小程序页面。第三方小程序格式：wx://appid/path或者wx://appid'
          },
          {
            label: '创建时间',
            width: 140,
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtCreate'
          },
          {
            label: '修改时间',
            width: 140,
            type: ColumnType.DATETIME,
            hiddenInForm: true,
            prop: 'gmtModified'
          },
          {
            label: '排序号',
            span: 24,
            required: true,
            width: 80,
            defaultValue: 0,
            prop: 'sortNum',
            type: ColumnType.NUMBER
          }
        ]
      }
    }
  },
  methods: {}
}
</script>

